<?php
namespace Home\Controller;
use Common\Controller\CommonController; 

class RepairsController extends CommonController{

	public function index(){
		$repair=M('appointment');
		$where['type']=2;
		$key=I("keyword");
		if(!empty($key)){
			$where['name'] = array("like","%".$key."%");
		}
		$status=I('status');
		//P($status);
		if($status!=""){
			$where['status'] = $status;
		}else{
			$where['status'] = 0;
		}
		$Count=$repair->where($where)->count();
		$Page = new \Think\Pager($Count,10);
		$show=$Page->showhtml();
		$repairList=$repair->where($where)->limit($Page->firstRow.",".$Page->listRows)->order("id desc")->select();
		$this->assign('page',$show);
		$this->assign('repairList',$repairList);
		$this->display();
	}
	public function upstatus(){
		$id=I('id');
		$re=M('appointment')->where(array('id'=>$id))->save(array('status'=>1));
		if($re){
			$this -> redirect('Repairs/index');
		}
	}


}